<html>
<head><meta charset="utf-8"><title>async fn and unused lifetime parameters · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/async.20fn.20and.20unused.20lifetime.20parameters.html">async fn and unused lifetime parameters</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="208483293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/async%20fn%20and%20unused%20lifetime%20parameters/near/208483293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eduardo Broto <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/async.20fn.20and.20unused.20lifetime.20parameters.html#208483293">(Aug 30 2020 at 12:39)</a>:</h4>
<p>From <a href="https://github.com/rust-lang/rust-clippy/issues/5983">this Clippy issue</a></p>
<p>With this function definition</p>
<div class="codehilite"><pre><span></span><code><span class="k">async</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>


<p>the return type desugars into</p>
<div class="codehilite"><pre><span></span><code><span class="k">impl</span><span class="w"> </span><span class="n">Future</span><span class="o">&lt;</span><span class="n">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="na">&#39;a</span><span class="w"></span>
</code></pre></div>


<p>Is it expected that the return type ends up tied to the lifetime even if it's not used in any input parameter? </p>
<p>In the linked issue, the user would expect the <a href="https://rust-lang.github.io/rust-clippy/master/#extra_unused_lifetimes">extra_unused_lifetimes</a> to be triggered, which seems reasonable, but it does not because the lifetime is used in the return type. I'm trying to see if this should be worked around in Clippy or could be considered a bug in the desugaring. Maybe I'm missing something?</p>
<p>Thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>